package com.tianji.learning.controller;


import com.tianji.api.dto.leanring.LearningLessonDTO;
import com.tianji.api.dto.leanring.LearningRecordDTO;
import com.tianji.api.dto.leanring.LearningRecordFormDTO;
import com.tianji.learning.domain.dto.LearningPlanDTO;
import com.tianji.learning.service.ILearningRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 学习记录表 前端控制器
 * </p>
 *
 * @author Ys
 * @since 2023-08-07
 */

@Api(tags = "学习记录（进度）")
@RestController
@RequestMapping("/learning-records")
public class LearningRecordController {


    @Autowired
    private ILearningRecordService learningRecordService;

    // 查询当前用户指定课程的学习进度
    @GetMapping("/course/{courseId}")
    @ApiOperation("查询到昂前用户指定课程的学习进度")
    public LearningLessonDTO queryLearningRecordByCourse(@PathVariable("courseId") Long courseId){
        return learningRecordService.queryLearningRecordByCourse(courseId);
    }

    @PostMapping
    @ApiOperation("提交学习记录")
    public void addLearningRecord(@RequestBody LearningRecordFormDTO learningRecordFormDTO){
        learningRecordService.addLearningRecord(learningRecordFormDTO);
    }




}
